package cn.logo.controller;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.logo.entities.Address;
import cn.logo.service.AddressService;


/**
 * 用户个人页
 * @author leimiaosen
 *
 */
@Controller
public class UserController {
	
	@Autowired
	private AddressService as;
	
	@RequestMapping("/edit/{id}")
	public String goEdit(@PathVariable("id") int id
			,Map<String, Object> map){
		List<Address> list = as.getAddress(id);
		map.put("addres", list);
		return "user/info";
	}
	@ResponseBody
	@RequestMapping(value="/address",method=RequestMethod.GET)
	public List<Address> getAddress(){
		List<Address> list = as.getAddress(2);
		System.out.println(list.size());
		return list;
	}
}
